<?php session_start();
include "constants_new.php";
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); 

if (!$link) { 
    die('Could not connect: ' . mysql_error()); 
} 
mysql_select_db(DB_NAME);

//Set up HOURS table

$sql = "CREATE TABLE IF NOT EXISTS HOURS (START VARCHAR(7) NOT NULL,CLOSE VARCHAR(7) NOT NULL)";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM HOURS";
$result = mysql_query($sql,$link);  	
$NHOurs = mysql_num_rows($result);
if($NHOurs==0) {
//Insert Values into HOURS table
$sql = "INSERT INTO HOURS(START, CLOSE) VALUES ('10:00am','5:30pm')";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM HOURS";
$result = mysql_query($sql,$link);  	
$NHOurs = mysql_num_rows($result);
}

//Create Holidays Table
$sql = "CREATE TABLE IF NOT EXISTS HOLIDAYS (NAMES VARCHAR(20) NOT NULL,DATES VARCHAR(10) NOT NULL)";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM HOLIDAYS";
$result = mysql_query($sql,$link);  	
$NHoliday=mysql_num_rows($result);
if($NHoliday==0){
//Insert Values into Holidays table
$sql = "INSERT INTO HOLIDAYS(NAMES, DATES) VALUES ('Family Day','02/18/2013'),('New Years Day','01/11/2013'),
	('Good Friday','03/29/2013'),('Victoria Day','05/20/2013'),('Canada Day','07/01/2013'),('Civic Day','08/05/2013')
	,('Labour Day','09/02/2013'),('Thanksgiving Day','10/14/2013'),('Rememberance Day','11/11/2013'),
	('Chrismas Day','12/25/2013'),('Boxing Day','12/26/2013')";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM HOLIDAYS";
$result = mysql_query($sql,$link);  	
$NHoliday=mysql_num_rows($result);
}

//Create state table
$sql = "CREATE TABLE IF NOT EXISTS STATES (PID INT NOT NULL AUTO_INCREMENT PRIMARY KEY, STATE VARCHAR(30) NOT NULL,RATE DOUBLE NOT NULL)";
$result = mysql_query($sql,$link);  	


$sql = "SELECT * FROM STATES";
$result = mysql_query($sql,$link);  	
$NSTATE=mysql_num_rows($result);
if($NSTATE==0) {
$sql = "INSERT INTO STATES(STATE, RATE) VALUES ('Ontario',21),('Quebec',21),('Alberta',23),('Manitoba',21),('Saskatchewan',21)
	,('Nova Scotia',21),('New Brunswick',21),('Newfoundland and Labrador',21),('British Columbia',21),
	('Northwest Territories',21),('Nunavut',21),('Prince Edward Island',21),('Yukon',21)";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM STATES";
$result = mysql_query($sql,$link);  	
$NSTATE=mysql_num_rows($result);

}

//Create COUPON table
$sql = "CREATE TABLE IF NOT EXISTS COUPON (CID INT NOT NULL AUTO_INCREMENT PRIMARY KEY, SYMBOL VARCHAR(10) NOT NULL, COUPON INT NOT NULL)";
$result = mysql_query($sql,$link);  	


$sql = "SELECT * FROM COUPON";
$result = mysql_query($sql,$link);  	
$NCOUPON=mysql_num_rows($result);
if($NCOUPON==0) {
$sql = "INSERT INTO COUPON(SYMBOL, COUPON) VALUES ('TEST',5)";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM COUPON";
$result = mysql_query($sql,$link);  	
$NCOUPON=mysql_num_rows($result);

}

//Delete Coupon Values
$sql = "DELETE FROM COUPON WHERE SYMBOL='TEST'";
$result = mysql_query($sql,$link);  	


//Create ADS table
$sql = "CREATE TABLE IF NOT EXISTS ADS (AID INT NOT NULL AUTO_INCREMENT PRIMARY KEY, MEDIA VARCHAR(20) NOT NULL)";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM ADS";
$result = mysql_query($sql,$link);  	
$NADS=mysql_num_rows($result);
if($NADS==0) {
$sql = "INSERT INTO ADS(MEDIA) VALUES ('www.cashhub.ca'),('Google'),('Yahoo'),('Bloomberg'),('Friend')
		,('Email'),('Promotion'),('Internet')";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM ADS";
$result = mysql_query($sql,$link);  	
$NADS=mysql_num_rows($result);

}

//Create Phone Carrier table
$sql = "CREATE TABLE IF NOT EXISTS CARRIERS (CID INT NOT NULL AUTO_INCREMENT PRIMARY KEY, NAMES VARCHAR(10) NOT NULL)";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM CARRIERS";
$result = mysql_query($sql,$link);  	
$NC=mysql_num_rows($result);
if($NC==0) {
$sql = "INSERT INTO CARRIERS(NAMES) VALUES ('Bell'),('Rogers'),('Fido'),('Telus'),('Virgin')
		,('Sasktel'),('MTS'),('Others')";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM CARRIERS";
$result = mysql_query($sql,$link);  	
$NC=mysql_num_rows($result);

}

//Create Login Table
$sql = "CREATE TABLE IF NOT EXISTS USERS (PID INT NOT NULL AUTO_INCREMENT PRIMARY KEY, USERNAME VARCHAR(50) NOT NULL,
	PWD VARCHAR(255) NOT NULL,CREDITS INT NOT NULL DEFAULT 0, DECLINENUMBER INT DEFAULT 0,REASON INT DEFAULT 0,DECLINEDATE VARCHAR(10) NULL,
	EMPLOYEE VARCHAR(20) NULL,VISITS INT DEFAULT 0,ROLES VARCHAR(20) NOT NULL,COMMENTS VARCHAR(500) NULL,DATES DATETIME NOT NULL)";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM USERS";
$result = mysql_query($sql,$link);  	
$NUSER=mysql_num_rows($result);

if($NUSER==0) {
$sql = "INSERT INTO USERS(USERNAME,PWD,CREDITS,ROLES,DATES) VALUES ('TEST','TEST',1,'CLIENT',NOW())";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM USERS";
$result = mysql_query($sql,$link);  	
$NUSER=mysql_num_rows($result);

}


//Create Login Table for Employee
$sql = "CREATE TABLE IF NOT EXISTS ADMINS (PID INT NOT NULL AUTO_INCREMENT PRIMARY KEY, USERNAME VARCHAR(50) NOT NULL,
	PWD VARCHAR(255) NOT NULL,ROLES VARCHAR(255) NOT NULL, FIRSTNAME VARCHAR(64) NOT NULL,LASTNAME VARCHAR(64) NOT NULL,EMAIL VARCHAR(50) NOT NULL)";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM ADMINS";
$result = mysql_query($sql,$link);  	
$NADMINS=mysql_num_rows($result);
if($NADMINS==0) {
$sql = "INSERT INTO ADMINS(USERNAME,PWD,ROLES,FIRSTNAME, LASTNAME,EMAIL) VALUES ('ADMIN',md5('12345678'),md5('PRINCIPAL'),'ADMIN','ADMIN','actwang@hotmail.com')";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM ADMINS";
$result = mysql_query($sql,$link);  	
$NADMINS=mysql_num_rows($result);

}

//Create EMPLOEEPROFILE Table, debug later---will create employee table if possible



//Delete USER TABLE Initial Value
$sql = "DELETE FROM USERS WHERE USERNAME='TEST'";
$result = mysql_query($sql,$link);  	


//Create Loan Amount Table
$sql = "CREATE TABLE IF NOT EXISTS LOANS (CREDITS INT NOT NULL, LOANAMOUNT DOUBLE NOT NULL)";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM LOANS";
$result = mysql_query($sql,$link);  	
$NLOAN=mysql_num_rows($result);
if($NLOAN==0) {
$sql = "INSERT INTO LOANS(CREDITS,LOANAMOUNT) VALUES (1,50),(1,100),(3,150),(7,200),(11,250),(16,300),(21,350),(26,400),
			(31,450),(36,500),(41,550),(46,600)";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM LOANS";
$result = mysql_query($sql,$link);  	
$NLOAN=mysql_num_rows($result);

}


//Create Profile Table
$sql = "CREATE TABLE IF NOT EXISTS PROFILES(PID INT NOT NULL,FIRSTNAME VARCHAR(64) NOT NULL,LASTNAME VARCHAR(64) NOT NULL,
		SIN VARCHAR(11) NOT NULL,GENDER VARCHAR(6) NOT NULL,EMAIL VARCHAR(50) NOT NULL PRIMARY KEY,DATEBIRTH VARCHAR(10) NOT NULL,
		ADDRESS VARCHAR(150) NOT NULL,CITY VARCHAR(100) NOT NULL,PROVINCE VARCHAR(25) NOT NULL,POSTCODE VARCHAR(7) NOT NULL,
		DATEIN VARCHAR(10) NOT NULL,CELLPHONE VARCHAR(14) NOT NULL, CARRIER VARCHAR(10) NOT NULL,FERERENCE VARCHAR(50) NOT NULL,
		RPHONE VARCHAR(20) NOT NULL,RELATIONSHIP VARCHAR(20) NOT NULL,MEDIA VARCHAR(50) NOT NULL,DATES DATETIME NOT NULL)";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM PROFILES";
$result = mysql_query($sql,$link);  	
$NPROFILE=mysql_num_rows($result);
if($NPROFILE==0) {
$sql = "INSERT INTO PROFILES(PID,FIRSTNAME,LASTNAME,SIN,GENDER,EMAIL,DATEBIRTH,
		ADDRESS,CITY,PROVINCE,POSTCODE,DATEIN,CELLPHONE,CARRIER,FERERENCE,RPHONE,RELATIONSHIP,MEDIA,DATES)
		VALUES (1,'TEST','TEST','111-111-111','female','TEST@HOTMAIL.COM','03/03/2000','TEST','TEST','TEST','MMM-MMM',
			'01/01/2000','(222) 222-2222','BELL','MARY','(222) 222-2222','FRIEND','TEST',NOW())";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM PROFILES";
$result = mysql_query($sql,$link);  	
$NPROFILE=mysql_num_rows($result);

}

//CLEAN PROFILE TABLE Initial Value
$sql = "DELETE FROM PROFILES WHERE PID='1'";
$result = mysql_query($sql,$link);  	



//Create Employment Table
$sql = "CREATE TABLE IF NOT EXISTS EMPLOYMENT (EID INT NOT NULL AUTO_INCREMENT PRIMARY KEY, PID INT NOT NULL,EMPLOYER VARCHAR(50) NOT NULL,EPHONE VARCHAR(20) NOT NULL,
		DATESTART VARCHAR(10) NOT NULL,JOBSTATUS VARCHAR(20) NULL,PAYTYPE VARCHAR(20) NULL, PAYFREQUENCY VARCHAR(2) NULL,INCOME DOUBLE NULL,DIRECTDEPOSIT VARCHAR(3) NULL)";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM EMPLOYMENT";
$result = mysql_query($sql,$link);  	
$NEMPLOYMENT=mysql_num_rows($result);
if($NEMPLOYMENT==0) {
$sql = "INSERT INTO EMPLOYMENT(PID,EMPLOYER,EPHONE,DATESTART,JOBSTATUS,PAYTYPE,PAYFREQUENCY,INCOME,DIRECTDEPOSIT)
		VALUES (1,'TEST','(222) 222-222','01/01/2000','FULL TIME','HOURLY','30',2000,'YES')";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM EMPLOYMENT";
$result = mysql_query($sql,$link);  	
$NEMPLOYMENT=mysql_num_rows($result);

}


//CLEAN Employment TABLE Initial Value
$sql = "DELETE FROM EMPLOYMENT WHERE PID='1'";
$result = mysql_query($sql,$link);  	


//Create Banking Table
$sql = "CREATE TABLE IF NOT EXISTS BANKING(BID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,PID INT NOT NULL,BANKNAME VARCHAR(50) NOT NULL,
		BTNID VARCHAR(5) NOT NULL,FINID VARCHAR(3) NOT NULL,CHECKID VARCHAR(20) NOT NULL,HISTORY VARCHAR(3) DEFAULT '0',DEBITID VARCHAR(25) NOT NULL,
		DEBITPWD VARCHAR(250) NOT NULL,SQ1 VARCHAR(50) NULL,AS1 VARCHAR(25) NULL,SQ2 VARCHAR(50) NULL,AS2 VARCHAR(25) NULL,SQ3 VARCHAR(50) NULL,
		AS3 VARCHAR(25) NULL,SQ4 VARCHAR(50) NULL,AS4 VARCHAR(25) NULL,SQ5 VARCHAR(50) NULL,AS5 VARCHAR(25) NULL)";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM BANKING";
$result = mysql_query($sql,$link);  	
$NBANKING=mysql_num_rows($result);
if($NBANKING==0) {
$sql = "INSERT INTO BANKING(PID,BANKNAME,BTNID,FINID,CHECKID,HISTORY,DEBITID,DEBITPWD,SQ1,AS1,SQ2,AS2,SQ3,AS3,SQ4,AS4,SQ5,AS5)
		VALUES (1,'BMO','123','1233','111111','0','222222','222222','TEST','ss','TEST','sss','TEST','sss','TEST','sss','TEST','sss')";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM BANKING";
$result = mysql_query($sql,$link);  	
$NBANKING=mysql_num_rows($result);

}

//CLEAN Banking TABLE Initial Value
$sql = "DELETE FROM BANKING WHERE PID='1'";
$result = mysql_query($sql,$link);  	

//Create Application Table
$sql = "CREATE TABLE IF NOT EXISTS APPLICATION(AID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,PID INT NOT NULL,
		BID INT NOT NULL,FIRSTPAY VARCHAR(10) NOT NULL, SECONDPAY VARCHAR(10) NOT NULL,APPLIEDLOAN DOUBLE NOT NULL,
		APPLIEDCOST DOUBLE NOT NULL,COUPON DOUBLE DEFAULT 0,APPROVEDLOAN DOUBLE DEFAULT 0,
		APPROVEDCOSTS DOUBLE DEFAULT 0,PAIDAMOUNT DOUBLE DEFAULT 0,STATUS VARCHAR(20) NOT NULL DEFAULT 'NEW',DEREASON VARCHAR(20) NULL,
		APPLIEDDATE DATETIME NOT NULL,APPROVEDDATE DATETIME NULL,PAYDAY VARCHAR(10) NULL,PADDAY VARCHAR(10) NULL,VISITS INT DEFAULT 1,
		NEWAMOUNT DOUBLE NOT NULL DEFAULT 0,EMPLOYEE VARCHAR(20) NULL,SIGNOFF VARCHAR(3) NULL)";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM APPLICATION";
$result = mysql_query($sql,$link);  	
$NAPPLICATION=mysql_num_rows($result);
if($NAPPLICATION==0) {
$sql = "INSERT INTO APPLICATION(PID,BID,FIRSTPAY,SECONDPAY, APPLIEDLOAN,APPLIEDCOST,APPROVEDLOAN,APPROVEDCOSTS,
		APPLIEDDATE,APPROVEDDATE,PAYDAY,PADDAY,EMPLOYEE)
		VALUES (1,1,'01/01/2000','01/01/2000',100,21,100,21,NOW(),NOW(),'01/01/2000','01/01/2000','TEST')";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM APPLICATION";
$result = mysql_query($sql,$link);  	
$NAPPLICATION=mysql_num_rows($result);

}

//CLEAN APPLICATION TABLE Initial Value
$sql = "DELETE FROM APPLICATION WHERE PID='1'";
$result = mysql_query($sql,$link);  

//Create STATUS Table
$sql = "CREATE TABLE IF NOT EXISTS APPSTATUS (SID INT NOT NULL AUTO_INCREMENT PRIMARY KEY, STATUS VARCHAR(20) NOT NULL)";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM APPSTATUS";
$result = mysql_query($sql,$link);  	
$NAPPSTATUS=mysql_num_rows($result);
if($NAPPSTATUS==0) {
$sql = "INSERT INTO APPSTATUS(STATUS) VALUES ('NEW'),('APPROVED'),('PAD'),('PAID'),('NSF'),('DEFAULT'),('DECLINED'),('COLLECTIONAGENCY')";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM APPSTATUS";
$result = mysql_query($sql,$link);  	
$NAPPSTATUS=mysql_num_rows($result);

}


//Create CONTACT Table
$sql = "CREATE TABLE IF NOT EXISTS CONTACT (CID INT NOT NULL AUTO_INCREMENT PRIMARY KEY, FIRSTNAME VARCHAR(50) NOT NULL,
	LASTNAME VARCHAR(50) NOT NULL, EMAIL VARCHAR(50) NOT NULL,PHONE VARCHAR(14) NOT NULL,COMMENTS VARCHAR(500) NOT NULL)";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM CONTACT";
$result = mysql_query($sql,$link);  	
$NCONTACT=mysql_num_rows($result);
if($NCONTACT==0) {
$sql = "INSERT INTO CONTACT(FIRSTNAME,LASTNAME,EMAIL,PHONE,COMMENTS)
	VALUES ('NEW','APPROVED','sss@ddd','2222222','NSF')";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM CONTACT";
$result = mysql_query($sql,$link);  	
$NCONTACT=mysql_num_rows($result);

}

//CLEAN CONTACT  TABLE Initial Value
$sql = "DELETE FROM CONTACT WHERE CID='1'";
$result = mysql_query($sql,$link);  


//Create REASONS Table
$sql = "CREATE TABLE IF NOT EXISTS REASONS (RID INT NOT NULL AUTO_INCREMENT PRIMARY KEY, REASON VARCHAR(50) NOT NULL)";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM REASONS";
$result = mysql_query($sql,$link);  	
$NREASONS=mysql_num_rows($result);
if($NREASONS==0) {
$sql = "INSERT INTO REASONS(REASON)
	VALUES ('seasonal job'),('low income'),('EI status'),('unemployment'),('account history < 3 months')
		,('payment by Check'),('multiple applications with one banking account'),('too many loans'),
		('default on loans'),('child tax income'),('invalid debit# or password'),
		('unanswered security questions'),('online fraud case'),('other reasons')";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM REASONS";
$result = mysql_query($sql,$link);  	
$NREASONS=mysql_num_rows($result);

}


//Create DEFAULTS Table
$sql = "CREATE TABLE IF NOT EXISTS DEFAULTS (DID INT NOT NULL AUTO_INCREMENT PRIMARY KEY, REASON VARCHAR(50) NOT NULL)";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM DEFAULTS";
$result = mysql_query($sql,$link);  	
$NDEFAULTS=mysql_num_rows($result);
if($NDEFAULTS==0) {
$sql = "INSERT INTO DEFAULTS(REASON)
	VALUES ('Account Closed'),('Account Changed'),('Payment Stopped'),('NSF'),('Fraud'),('Bankruptcy'),('others')";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM DEFAULTS";
$result = mysql_query($sql,$link);  	
$NDEFAULTS=mysql_num_rows($result);

}


//Create ROLES Table
$sql = "CREATE TABLE IF NOT EXISTS ROLES (RID INT NOT NULL AUTO_INCREMENT PRIMARY KEY, ROLES VARCHAR(50) NOT NULL)";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM ROLES";
$result = mysql_query($sql,$link);  	
$NROLES=mysql_num_rows($result);
if($NROLES==0) {
$sql = "INSERT INTO ROLES(ROLES)
	VALUES ('CLIENT'),('EMPLOYEE'),('PRINCIPAL')";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM ROLES";
$result = mysql_query($sql,$link);  	
$NROLES=mysql_num_rows($result);

}



//Create Canada Banks Table
$sql = "CREATE TABLE IF NOT EXISTS CANADIANBANKS(BID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,BANKSHORTNAME VARCHAR(20) NOT NULL,
		BANKLONGNAME VARCHAR(50) NOT NULL)";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM CANADIANBANKS";
$result = mysql_query($sql,$link);  	
$NCANADIANBANKS=mysql_num_rows($result);
if($NCANADIANBANKS==0) {
$sql = "INSERT INTO CANADIANBANKS(BANKSHORTNAME,BANKLONGNAME)
		VALUES ('BMO','Bank of Montreal'),('CIBC','Canadian Imperial Bank of Commerce'),('TD','TD Canada Trust'),
			('RBC','Royal Bank of Canada'),('Scotia','Scotiabank'),('HSBC','HSBC Bank Canada'),
			('NBC','National Bank of Canada'),('Others','Other Banks')";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM CANADIANBANKS";
$result = mysql_query($sql,$link);  	
$NCANADIANBANKS=mysql_num_rows($result);

}




//Create question table
$sql = "CREATE TABLE IF NOT EXISTS QUESTIONS(QID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,QUESTIONS VARCHAR(500) NOT NULL,TITLES VARCHAR(50) NOT NULL)";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM QUESTIONS";
$result = mysql_query($sql,$link);  	
$NQUESTIONS=mysql_num_rows($result);
if($NQUESTIONS==0) {
$sql = "INSERT INTO QUESTIONS(QUESTIONS,TITLES)
		VALUES ('Due to NSF happened in your banking account, your repayment has been returned to your bank account. As a valued customer, we will leave this payment as your new loan and debit this amount plus corresponding cost from your account on your next payday','NSF')";
$result = mysql_query($sql,$link);  	

$sql = "SELECT * FROM QUESTIONS";
$result = mysql_query($sql,$link);  	
$NQUESTIONS=mysql_num_rows($result);

}



?>


<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<body>
<--Set up HOURS Table-->
<?php if ($NHOurs!=0) { ?>

<p>The HOURS table has been set up successfully</p>

<?php } ?>

<?php if ($NHOurs==0) { ?>

<p>Sorry, the HOURS table has not been set up yet</p>

<?php } ?>

<--Set up holiday table-->
<?php if ($NHoliday!=0) { ?>

<p>The holiday table has been set up successfully</p>

<?php } ?>

<?php if ($NHoliday==0) { ?>

<p>Sorry, the holiday table has not been set up yet</p>

<?php } ?>

<--Set up STATES table-->
<?php if ($NSTATE!=0) { ?>

<p>The provinces table has been set up successfully</p>

<?php } ?>

<?php if ($NSTATE==0) { ?>

<p>Sorry, the provinces table has not been set up yet</p>

<?php } ?>


<--Set up COUPON table-->
<?php if ($NCOUPON!=0) { ?>

<p>The Coupon table has been set up successfully</p>

<?php } ?>

<?php if ($NCOUPON==0) { ?>

<p>Sorry, the Coupon table has not been set up yet</p>

<?php } ?>


<--Set up ADS table-->
<?php if ($NADS!=0) { ?>

<p>The advertisement table has been set up successfully</p>

<?php } ?>

<?php if ($NADS==0) { ?>

<p>Sorry, the advertisement table has not been set up yet</p>

<?php } ?>

<--Set up CARRIERS table-->
<?php if ($NC!=0) { ?>

<p>The phone carrier table has been set up successfully</p>

<?php } ?>

<?php if ($NC==0) { ?>

<p>Sorry, the phone carrier has not been set up yet</p>

<?php } ?>

<--Set up USERs table-->
<?php if ($NUSER!=0) { ?>

<p>The USRR table has been set up successfully</p>

<?php } ?>

<?php if ($NUSER==0) { ?>

<p>Sorry, the USER Table has not been set up yet</p>

<?php } ?>

<--Set up Loan Amount table-->
<?php if ($NLOAN!=0) { ?>

<p>The Loan amount table has been set up successfully</p>

<?php } ?>

<?php if ($NLOAN==0) { ?>

<p>Sorry, the Loan anmount Table has not been set up yet</p>

<?php } ?>

<--Set up Profile table-->
<?php if ($NPROFILE!=0) { ?>

<p>The profile table has been set up successfully</p>

<?php } ?>

<?php if ($NPROFILE==0) { ?>

<p>Sorry, the Profile Table has not been set up yet</p>

<?php } ?>


<--Set up Employer table-->
<?php if ($NEMPLOYMENT!=0) { ?>

<p>The employer table has been set up successfully</p>

<?php } ?>

<?php if ($NEMPLOYMENT==0) { ?>

<p>Sorry, the Employer Table has not been set up yet</p>

<?php } ?>


<--Set up Banking table-->
<?php if ($NBANKING!=0) { ?>

<p>The BANKING table has been set up successfully</p>

<?php } ?>

<?php if ($NBANKING==0) { ?>

<p>Sorry, the BANKING Table has not been set up yet</p>

<?php } ?>


<--Set up APPLICATION table-->
<?php if ($NAPPLICATION!=0) { ?>

<p>The APPLICATION table has been set up successfully</p>

<?php } ?>

<?php if ($NAPPLICATION==0) { ?>

<p>Sorry, the APPLICATION Table has not been set up yet</p>

<?php } ?>




<--Set up APPSTATUS table-->
<?php if ($NAPPSTATUS!=0) { ?>

<p>The APPSTATUS table has been set up successfully</p>

<?php } ?>

<?php if ($NAPPSTATUS==0) { ?>

<p>Sorry, the APPSTATUS Table has not been set up yet</p>

<?php } ?>

<--Set up CONTACT table-->
<?php if ($NCONTACT!=0) { ?>

<p>The CONTACT table has been set up successfully</p>

<?php } ?>

<?php if ($NCONTACT==0) { ?>

<p>Sorry, the CONTACT Table has not been set up yet</p>

<?php } ?>


<--Set up REASONS table-->
<?php if ($NREASONS!=0) { ?>

<p>The REASONS table has been set up successfully</p>

<?php } ?>

<?php if ($NREASONS==0) { ?>

<p>Sorry, the REASONS Table has not been set up yet</p>

<?php } ?>

<--Set up ROLES table-->
<?php if ($NROLES!=0) { ?>

<p>The ROLES table has been set up successfully</p>

<?php } ?>

<?php if ($NROLES==0) { ?>

<p>Sorry, the ROLES Table has not been set up yet</p>

<?php } ?>

<--Set up CANADIANBANKS table-->
<?php if ($NCANADIANBANKS!=0) { ?>

<p>The CANADIANBANKS table has been set up successfully</p>

<?php } ?>

<?php if ($NCANADIANBANKS==0) { ?>

<p>Sorry, the CANADIANBANKS Table has not been set up yet</p>

<?php } ?>


<--Set up ADMINS table-->
<?php if ($NADMINS!=0) { ?>

<p>The ADMINS table has been set up successfully</p>

<?php } ?>

<?php if ($NADMINS==0) { ?>

<p>Sorry, the ADMINS Table has not been set up yet</p>

<?php } ?>


<--Set up DEFAULTS table-->
<?php if ($NDEFAULTS!=0) { ?>

<p>The DEFAULTS table has been set up successfully</p>

<?php } ?>

<?php if ($NDEFAULTS==0) { ?>

<p>Sorry, the DEFAULTS Table has not been set up yet</p>

<?php } ?>





<--Set up QUESTIONS table-->
<?php if ($NQUESTIONS!=0) { ?>

<p>The QUESTIONS table has been set up successfully</p>

<?php } ?>

<?php if ($NQUESTIONS==0) { ?>

<p>Sorry, the QUESTIONS Table has not been set up yet</p>

<?php } ?>

</body>
</html>